<!-- content for head -->
<% content_for :head do %>
  <%= javascript_include_tag "sns-bundle" %>

<% end %>
      <div class="span9">
        <div class="well well-small">共计 <%= Utility.const_get(@sns_type.capitalize).count %> 位用户， 可用 <%= Utility.const_get(@sns_type.capitalize).active.count %> 位.</div>

        <div class="clearfix" style="margin-bottom:10px;">
          <label class="select-btn checkbox">
            <input type="checkbox">全选</label>
<!--           <div class="btn-group">
            <button class="btn">
              <i class="icon-trash"></i>
            </button>
            <button class="btn">
              <i class="icon-ban-circle"></i>
            </button>
          </div> -->
          <span class="pull-right">

            <a class="btn autoacs-btn" href="?">
                自动授权(慎用)
            </a>
            <a class="btn" href="/sns/new">
              添加新账号
            </a>
            <div class="btn-group" style="margin-top:1px;">
              <% if params[:t].nil? or params[:t].capitalize == 'Weibo' %>
              <a class="btn btn-small" href="?t=Weibo">
                <i class="icon-ok icon-white"></i>
                新浪
              </a>
              <a class="btn btn-small dropdown-toggle" data-toggle="dropdown" href="#">
                <span class="caret"></span>
              </a>
              <ul class="dropdown-menu">
                <li>
                  <a href="?t=Tencent">
                    <i class="icon-ok"></i>
                    腾讯
                  </a>
                </li>
              </ul>
             <% elsif params[:t].capitalize == 'Tencent' %>
              <a class="btn btn-small" href="?t=Tencent">
                <i class="icon-ok icon-white"></i>
                腾讯
              </a>
              <a class="btn btn-small dropdown-toggle" data-toggle="dropdown" href="#">
                <span class="caret"></span>
              </a>
              <ul class="dropdown-menu">
                <li>
                  <a href="?t=Weibo">
                    <i class="icon-ok"></i>
                    新浪
                  </a>
                </li>
              </ul>
             <% end -%>

            </div>
          </span>

        </div>
        <table id="users" class="table table-hover">
          <tbody>
            <% @sns_users.each do |sns_user| %>
            <tr id="<%= sns_user._id %>">
              <td>
                <label class="checkbox">
                  <input type="checkbox">
                  <span class="tip" data-toggle="popover" data-placement="top" data-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus." title="" data-original-title="Popover on top"><%= sns_user.username %></span>
                </label>
              </td>
              <td>
                <%= sns_user.status["login"] ? "正常登陆" : "登录异常"%>
              </td>
              <td>
                <%= sns_user.expires_in.strftime('%m-%d 日 %H 时') %>
              </td>
              <td>
                <% if sns_user.status["login"] %>
                <div class="btn-group pull-right" style="margin-top:1px;">
                  <a class="btn btn-small btn-success disabled" href="#">
                    <i class="icon-ok icon-white"></i>
                    已授权
                  </a>
                  <a class="btn btn-small btn-success dropdown-toggle" data-toggle="dropdown" href="#">
                    <span class="caret"></span>
                  </a>
                  <ul class="dropdown-menu">
                    <li>
                      <a href="#" class="keat-btn">
                        <i class="icon-remove"></i>
                        授权续期
                      </a>
                    </li>
                    <li>
                      <a href="#" class="stop-btn">
                        <i class="icon-ban-circle"></i>
                        停用
                      </a>
                    </li>
                    <li>
                      <a href="#" class="delete-btn">
                        <i class="icon-trash"></i>
                        删除
                      </a>
                    </li>
                  </ul>
                </div>
                <% else %>
                <div class="btn-group pull-right" style="margin-top:1px;">
                  <a class="btn btn-small btn-danger disabled" href="#">
                    <i class="icon-ok icon-white"></i>
                    已停用
                  </a>
                  <a class="btn btn-small btn-danger dropdown-toggle" data-toggle="dropdown" href="#">
                    <span class="caret"></span>
                  </a>
                  <ul class="dropdown-menu">
                    <li>
                      <a href="#" class="reat-btn">
                        <i class="icon-repeat"></i>
                        重新授权
                      </a>
                    </li>
                    <li>
                      <a href="#" class="revive-btn">
                        <i class="icon-repeat"></i>
                        重新启用
                      </a>
                    </li>
                    <li>
                      <a href="#" class="delete-btn">
                        <i class="icon-trash"></i>
                        删除
                      </a>
                    </li>
                  </ul>
                </div>
                <% end -%>
              </td>
            </tr>
            <% end %>
          </tbody>
        </table>
        <div class="clearfix">
          <label class="select-btn checkbox">
            <input type="checkbox">全选</label>
<!--           <div class="btn-group">
            <button class="btn">
              <i class="icon-trash"></i>
            </button>
            <button class="btn">
              <i class="icon-ban-circle"></i>
            </button>
          </div> -->
        </div>